//worker
var http = require('http')

var server = http.createServer((req, res) => {
        res.end('hahahaha'+process.pid)
 })//不监听

process.on('message', (msg, tcp) => {

    if (msg === 'server') {
        const handler = tcp
        handler.on('connection', socket => {//代表有链接
        	console.log(socket);
            server.emit('connection', socket)//emit方法触发 worker服务器的connection
        })
    }
})